<template>
  <div class="hospital-container">
    <!-- 顶部标题栏 -->
    <div class="header">
      <div class="back-btn" @click="goBack">←</div>
      <h1>请您选择体检机构</h1>
    </div>
    
    <!-- 机构列表 -->
    <div class="hospital-list">
      <!-- 和平院区 --> 
	  <div class="next-btn" @click="goNext">
      <div class="hospital-card">
        <div class="hospital-image">
          <img src="@/assets/hospita1.png" alt="和平院区">
        </div>
        <div class="hospital-info">
          <div class="hospital-name">沈阳熙康云医院-和平院区</div>
          <div class="hospital-detail">
            <div class="detail-item">
              <span class="label">营业时间</span>
              <span class="value">周一至周五 7:30-15:30 (周六截止12:00)</span>
            </div>
            <div class="detail-item">
              <span class="label">采血截止</span>
              <span class="value">采血截止时间 10:30</span>
            </div>
            <div class="detail-item">
              <span class="label">电话</span>
              <span class="value">52433456</span>
            </div>
            <div class="detail-item">
              <span class="label">地址</span>
              <span class="value">文体路7号世贸大厦商都(五里河茶城)四楼西区</span>
            </div>
          </div>
          <div class="hospital-actions">
            <button class="action-btn contact" @click="contactHospital('和平院区')">联系我们</button>
            <button class="action-btn location" @click="findLocation('和平院区')">查找位置</button>
          </div>
        </div>
      </div>
	  </div>
      
      <!-- 浑南院区 -->
	  <div class="next-btn" @click="goNext">
      <div class="hospital-card">
        <div class="hospital-image">
          <img src="@/assets/hospita2.png" alt="浑南院区">
        </div>
        <div class="hospital-info">
          <div class="hospital-name">沈阳熙康云医院-浑南院区</div>
          <div class="hospital-detail">
            <div class="detail-item">
              <span class="label">营业时间</span>
              <span class="value">周一至周六 7:30-11:30</span>
            </div>
            <div class="detail-item">
              <span class="label">采血截止</span>
              <span class="value">10:30</span>
            </div>
            <div class="detail-item">
              <span class="label">电话</span>
              <span class="value">52713658</span>
            </div>
            <div class="detail-item">
              <span class="label">地址</span>
              <span class="value">创新路175号(与智慧大厦交汇处)</span>
            </div>
          </div>
          <div class="hospital-actions">
            <button class="action-btn contact" @click="contactHospital('浑南院区')">联系我们</button>
            <button class="action-btn location" @click="findLocation('浑南院区')">查找位置</button>
          </div>
        </div>
      </div>
    </div>
	  </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
      <div class="nav-item" :class="{ active: currentNav === 'hospital' }">
        <span class="nav-icon">🏥</span>
        <span class="nav-text">云医院</span>
      </div>
      <div class="nav-item" :class="{ active: currentNav === 'mall' }">
        <span class="nav-icon">🛒</span>
        <span class="nav-text">商城</span>
      </div>
      <div class="nav-item" :class="{ active: currentNav === 'discover' }">
        <span class="nav-icon">🔍</span>
        <span class="nav-text">发现</span>
      </div>
      <div class="nav-item" :class="{ active: currentNav === 'personal' }" @click="goToPersonal">
        <span class="nav-icon">👤</span>
        <span class="nav-text">我</span>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const currentNav = ref('hospital')

// 返回上一页
const goBack = () => {
  router.back()
}

// 继续下一页
const goNext = () => {
  router.push('/setmeal')
}

// 跳转到个人中心
const goToPersonal = () => {
  router.push('/personal')
}
</script>

<style scoped>
.hospital-container {
  min-height: 100vh;
  background-color: #f5f5f5;
  padding-bottom: 60px;
}

.header {
  position: relative;
  background: white;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.back-btn {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  cursor: pointer;
}

.header h1 {
  margin: 0;
  font-size: 16px;
  color: #333;
}

.hospital-list {
  padding: 15px;
}

.hospital-card {
  background: white;
  border-radius: 8px;
  margin-bottom: 15px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hospital-image {
  width: 100%;
  height: 120px;
  overflow: hidden;
}

.hospital-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hospital-info {
  padding: 15px;
}

.hospital-name {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}

.hospital-detail {
  margin-bottom: 15px;
}

.detail-item {
  display: flex;
  margin-bottom: 8px;
  font-size: 12px;
}

.label {
  color: #666;
  width: 60px;
  flex-shrink: 0;
}

.value {
  color: #333;
  flex: 1;
}

.hospital-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.contact {
  background: #f0f0f0;
  color: #333;
}

.location {
  background: #1890ff;
  color: white;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  border-top: 1px solid #eee;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.nav-text {
  font-size: 10px;
  color: #666;
}

.nav-item.active .nav-text {
  color: #1890ff;
}
</style>